Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: connection management and error handling #1986

Merged
merged 2 commits into from
Dec 9, 2023
Merged

improve: connection management and error handling #1986

merged 2 commits into from
Dec 9, 2023

Conversation

beats-dh
Copy link
Collaborator

@beats-dh beats-dh commented Dec 6, 2023

Connection Management Refinements and Error Handling Improvements

This PR implements several key changes, include:

Enhanced Error Handling

  • More detailed logs for better debugging and error analysis.

Simplification and Refactoring

  • Critical methods such as Connection::close and Connection::accept have been simplified and refactored for clarity.

Precise Timeout Management

  • std::chrono::milliseconds implemented for more accurate timeout settings.

Improved Protocol Management

  • Better handling of connection states and protocol management.

Robust Socket Closure

  • Addition of socket.cancel(); in Connection::closeSocket() ensures cancellation of pending asynchronous operations, increasing safety during socket closure.

Safe Message Sending

  • State of the socket is now checked before sending messages, preventing attempts to write on closed sockets.

Optimized Thread Safety

  • Utilization of std::scoped_lock and std::unique_lock optimized for safer thread handling.

Improved IP and Timeout Handling

  • Enhancements in IP management and more efficient timeout handling.

luan

This comment was marked as resolved.

@beats-dh beats-dh changed the title improve: connection connection: Management Refinements and Error Handling Improvements Dec 7, 2023
@beats-dh

This comment was marked as resolved.

@luan luan changed the title connection: Management Refinements and Error Handling Improvements improve: connection management and error handling Dec 9, 2023
@luan luan merged commit 6b187fb into main Dec 9, 2023
32 of 33 checks passed
@luan luan deleted the connection branch December 9, 2023 20:37
Copy link

sonarqubecloud bot commented Dec 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants